<?php

/**
 * DZTOrder form base class.
 *
 * @method DZTOrder getObject() Returns the current form's model object
 *
 * @package    DZTidjara
 * @subpackage form
 * @author     Amine KHIAT
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseDZTOrderForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'user_id'             => new sfWidgetFormInputHidden(),
      'product_id'          => new sfWidgetFormInputHidden(),
      'billing_address_id'  => new sfWidgetFormInputHidden(),
      'delivery_address_id' => new sfWidgetFormInputHidden(),
      'is_active'           => new sfWidgetFormInputCheckbox(),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'user_id'             => new sfValidatorChoice(array('choices' => array($this->getObject()->get('user_id')), 'empty_value' => $this->getObject()->get('user_id'), 'required' => false)),
      'product_id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('product_id')), 'empty_value' => $this->getObject()->get('product_id'), 'required' => false)),
      'billing_address_id'  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('billing_address_id')), 'empty_value' => $this->getObject()->get('billing_address_id'), 'required' => false)),
      'delivery_address_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('delivery_address_id')), 'empty_value' => $this->getObject()->get('delivery_address_id'), 'required' => false)),
      'is_active'           => new sfValidatorBoolean(array('required' => false)),
      'created_at'          => new sfValidatorDateTime(),
      'updated_at'          => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('dzt_order[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'DZTOrder';
  }

}
